package com.swipemaster.common;

/**
 * Universal coordinates, from 0.0 to 1.0.
 */
public class Coords
{
	public double x;
	public double y;
	
	public Coords(double x, double y)
	{
		if (x < 0 || x > 1 || y < 0 || y > 1)
		{
			throw new IllegalArgumentException("Universal coordinates are from 0.0 to 1.0");
		}
		this.x = x;
		this.y = y;
	}
	
	public static Coords getUniversal(int screenX, int screenY)
	{
		double x = (double) screenX / Constants.screenWidth;
		double y = (double) screenY / Constants.screenHeight;
		return new Coords(x, y);
	}
	
	public static double pitagoras(double a, double b)
	{
		return Math.sqrt(a*a + b*b);
	}
}
